/*
 * @Author: hu_binbin
 * @Date: 2021-06-02 15:08:57
 * @LastEditTime: 2021-07-10 15:15:03
 * @Description: 巡视任务api
 */

import request from '@/utils/request'

/**
 * @description: 创建任务 
 * @param {Object} data 请求参数
 */
export function addTourTask(data) {
	return new Promise((resolve, reject) => {
        //server-name/sys/sendPhoneSms
        request.post('/server-name/sys/sendPhoneSms', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 编辑任务 
 * @param {Object} data 请求参数
 */
export function editTourTask(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/task/addOrEditTask', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description:  查询巡视任务列表 
 * @param {Object} data 请求参数
 */
export function queryTourTaskList(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/task/getTaskList', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description:  任务开始 
 * @param {Object} data 请求参数
 */
export function confirmStartInfo(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/task/confirmStartInfo', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description:  结束巡视任务 
 * @param {Object} data 请求参数
 */
export function endTourTask(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/task/finishAppPatrolPlan', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description:  获取巡视任务详情 
 * @param {Object} data 请求参数
 */
export function getTourTaskDetail(data) {
	return new Promise((resolve, reject) => {
        //server-name/sys/sendPhoneSms
        request.post('/server-name/sys/sendPhoneSms', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}


/**
 * @description:  获取未完成任务列表
 * @param {Object} data 请求参数
 */
export function queryUnfinishTourTask(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/task/getNotExecuteTask', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 获取缺陷记录 
 * @param {Object} data 请求参数
 */
export function getDefectRecord(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/infoInquiry/getDefectListForApp', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 获取隐患记录 
 * @param {Object} data 请求参数
 */
export function getHazardList(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/infoInquiry/getHazardListForApp', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * @description: 获取台账记录
 * @param {Object} data 请求参数
 */
export function getDevAccount(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/infoInquiry/getDevAccount', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 查询作业卡信息
 * @param {Object} data 请求参数
 */
export function queryWorkCard(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/task/queryCardInfos', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 查询试验记录
 * @param {Object} data 请求参数
 */
export function getTestRecord(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/infoInquiry/getTestRecord', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 履历-查询智能表计信息
 * @param {Object} data 请求参数
 */
export function getIntelligentMeter(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/infoInquiry/getIntelligentMeter', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 履历-履历-查询检修记录
 * @param {Object} data 请求参数
 */
export function getcheckRecord(data) {
	return new Promise((resolve, reject) => {
        request.post('/app/infoInquiry/getRepaidRecord', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}